import { defineStore } from 'pinia'

export const useShopStore = defineStore('shop', {
  state: () => ({
    shops: [],
    currentShop: null,
    loading: false
  }),
  
  getters: {
    activeShops: (state) => state.shops.filter(shop => shop.status === 'active'),
    shopCount: (state) => state.shops.length
  },
  
  actions: {
    async fetchShops() {
      this.loading = true
      try {
        // 这里添加获取商店列表的API调用
        // const response = await api.getShops()
        // this.shops = response.data
      } catch (error) {
        console.error('获取商店列表失败:', error)
      } finally {
        this.loading = false
      }
    },
    
    setCurrentShop(shop) {
      this.currentShop = shop
    }
  }
}) 